<%--
  Created by IntelliJ IDEA.
  User: 梁玉杰
  Date: 2021/7/16
  Time: 18:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.util.Date" %><%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/head.jsp" %>

<% Date date = new Date(); request.setAttribute("date", date); %>

<div style="position:absolute;left:210px;">
    <span class="layui-breadcrumb">
      <a href="${pageContext.request.contextPath }/WEB-INF/view/welcome.jsp">首页</a>
      <a><cite>会员管理</cite></a>
    </span>
</div>
<form style="margin-left: 210px;margin-top: 30px" class="layui-form layui-form-pane" action="${pageContext.request.contextPath }/MenfindAll">
    <input type="hidden" name="method" value="list">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${param.name}">
            </div>
        </div>
        <div class="layui-inline" style="margin-left: -50px">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" lay-verify="required" autocomplete="off" class="layui-input" value="${param.phone}">
            </div>
        </div>
        <div class="layui-inline" style="margin-left: -50px">
            <label class="layui-form-label">会员卡号</label>
            <div class="layui-input-inline">
                <input type="text" name="code" lay-verify="required" autocomplete="off" class="layui-input" value="${param.code}">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn" id="get">查询</button>
            </div>
        </div>
    </div>
</form>
<div class="layui-form-item" style="margin-left: 1180px;margin-top: -58px">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <button type="button" data-method="demo" class="layui-btn" id="addbtn">
                <i class="layui-icon">&#xe608;</i>办理会员
            </button>
        </div>
    </div>
</div>
<div style="position:absolute;left:210px;top:130px;">
    <div class="layui-col-md10">
        <!-- 使用分页时需要定义:lay-filter="graduate-list -->
        <table class="layui-table" lay-data="{width:747}" lay-size="lg" lay-filter="form-list">
            <thead>
            <tr>
                <th lay-data="{type:'numbers'}">学号</th>
                <th lay-data="{field:'graduateName',align:'center',unresize:true,sort:true,width:120}">学生姓名</th>
                <th lay-data="{field:'phone',align:'center',unresize:true,sort:true,width:120}">手机号</th>
                <th lay-data="{field:'code',align:'center',unresize:true,sort:true,width:20}">性别</th>
                <th lay-data="{field:'leaveCount',align:'center',unresize:true,sort:true,width:20}">年龄</th>
                <th lay-data="{field:'endTime',align:'center',unresize:true,sort:true,width:120}">证件号码</th>
                <th lay-data="{field:'endTime',align:'center',unresize:true,sort:true,width:20}">出生日期</th>
                <th lay-data="{field:'endTime',align:'center',unresize:true,sort:true,width:20}">详细地址</th>
                <th lay-data="{field:'endTime',align:'center',unresize:true,sort:true,width:20}">创建时间</th>
                <th lay-data="{field:'endTime',align:'center',unresize:true,sort:true,width:20}">修改时间</th>
                <th lay-data="{field:'edit',align:'center',unresize:true,sort:true,width:100}">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="member" items="${stu}">
                <tr>
                    <td>
                        <span style="color: #5FB878">${member.stuNum}</span>
                    </td>
                    <td>
                        <a style="color: #1E9FFF" href="${pageContext.request.contextPath }/MenfindId?id=${member.stuId}" onclick="viewInfo('${member.stuId}')">${member.stuName}</a>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.mobile}</span>
                    </td>
                    <td>
                        <span style="color: #5FB878">
                            <c:if test="${member.sex == F}">女生</c:if>
                            <c:if test="${member.sex == M}">男生</c:if>
                        </span>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.age}</span>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.idNum}</span>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.birthday}</span>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.province}${member.city}${member.area}</span>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.createDate}</span>
                    </td>
                    <td>
                        <span style="color: #5FB878">${member.updateDate}</span>
                    </td>
                    <td>
                        <a style="color: #FFB800" href="javascript:;" onclick="editInfo('${member.stuId}')"><i class="layui-icon">&#xe642;</i></a>&nbsp;&nbsp;
                        <a style="color: #FF5722" href="javascript:;" onclick="xufeiInfo('${member.stuId}')"><i class="layui-icon">&#xe65e;</i></a>
                        <a style="color: #FF5722" href="javascript:;" onclick="qingjiacInfo('${member.stuId}')"><i class="layui-icon">&#xe637;</i></a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>
<input type="hidden" id="handle_status">
<%@include file="../common/foot.jsp" %>
<script>
    $(document).ready(function () {
        $('#get').attr('action','jsp/vip')
    })
    // 设置当前路径
    var pageUrl = "${pageContext.request.contextPath }";
    <!-- 使用分页时需要定义 -->
    var pageSize = "${pageSize}";
    <!-- 使用分页时需要定义 -->
    var pageGroup = "${pageGroup}";

    $(document).ready(function () {
        layui.use('element', function () {
            var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
        });

        layui.use('layer', function () {
            var $ = layui.jquery, layer = layui.layer;
            var url, msg,area1,area2;

            //触发事件
            var active = {
                demo: function () {
                    //弹出层
                    layer.open({
                        type: 2
                        ,title: msg //标题栏
                        ,closeBtn: 1 // 右上角关闭按钮样式，可通过配置1和2来展示，如果不显示，则closeBtn: 0
                        ,area: [area1, area2]
                        ,shade: 0.4
                        ,id: 'demo' //设定一个id，防止重复弹出
                        ,move: false
                        ,content: [url , 'no']
                        ,end: function () {
                            var handle_status = $("#handle_status").val();
                            if (handle_status == '1') {
                                layer.msg(msg + '成功！', {
                                    icon: 1,
                                    time: 1000 //1秒关闭（如果不配置，默认是3秒）
                                }, function () {
                                    history.go(0);
                                });
                            } else if (handle_status == '0') {
                                layer.msg(msg + '失败！', {
                                    icon: 2,
                                    time: 2000 //1秒关闭（如果不配置，默认是3秒）
                                });
                            }
                        }
                    });
                }
            };

            // 添加
            $('#addbtn').on('click', function () {
                url = pageUrl + '/MenAdd';
                msg = '添加';
                area1 = '660px';
                area2 = '620px';
                var othis = $(this), method = 'demo';
                active[method] ? active[method].call(this, othis) : '';
            });

            // 编辑
            window.editInfo = function (id) {
                url = pageUrl + '/updatefindById?id=' + id;
                msg = '修改';
                area1 = '300px';
                area2 = '600px';
                var othis = $(this), method = 'demo';
                active[method] ? active[method].call(this, othis) : '';
            };

            // 续费
            window.xufeiInfo = function (id) {
                url = pageUrl + '/Vipxf?id=' + id;
                msg = '续费';
                area1 = '650px';
                area2 = '460px';
                var othis = $(this), method = 'demo';
                active[method] ? active[method].call(this, othis) : '';
            };

            // 请假
            window.qingjiacInfo = function (id) {
                url = pageUrl + '/Vipqingjia?id=' + id;
                msg = '请假';
                area1 = '400px';
                area2 = '480px';
                var othis = $(this), method = 'demo';
                active[method] ? active[method].call(this, othis) : '';
            };

            // // 删除
            // window.delInfo = function (id) {
            //     layer.confirm('是否请假？', {icon: 2, title:'提示'}, function(index){
            //         $.ajax({
            //             url: pageUrl + '/jsp/demo',
            //             data: {'id': id, 'method': 'del'},//
            //             dataType: "json",
            //             async: true,
            //             type: "post",
            //             success: function (responstText) {
            //                 if (responstText.success == '1') {
            //                     layer.msg('删除成功！', {
            //                         icon: 1,
            //                         time: 1000 //1秒关闭（如果不配置，默认是3秒）
            //                     }, function () {
            //                         history.go(0);
            //                     });
            //                 } else if (responstText.success == '0') {
            //                     layer.msg('删除失败！', {
            //                         icon: 2,
            //                         time: 2000 //1秒关闭（如果不配置，默认是3秒）
            //                     });
            //                 }
            //             }
            //         });
            //     });
            // };
        });
    });
</script>
<!-- 使用分页时需要引入分页js -->
<script type="text/javascript" src="${pageContext.request.contextPath }/static/js/page.js"></script>
